﻿Option Explicit On
Imports System

Imports System.Data.Common

Namespace Data_Report3TableAdapters
    Partial Public Class RP15TableAdapter
        Inherits System.ComponentModel.Component

        Public Function GetDataByFilter(ByVal dataTable As Data_Report3.RP15DataTable, ByVal SQLExpression As String) As Integer
            Dim OriginalCommandText As String
            OriginalCommandText = Me.CommandCollection(0).CommandText
            Dim timeout As Integer
            Dim newtime As Integer = timeout
            Try
                newtime = Val(ConfigurationManager.AppSettings("QueryTimeOut"))
            Catch ex As Exception
                newtime = timeout
            End Try
            timeout = Me.CommandCollection(0).CommandTimeout
            Try
                Me.CommandCollection(0).CommandText = SQLExpression
                Me.CommandCollection(0).CommandTimeout = newtime
                Return Me.Fill(dataTable)
            Catch ex As Exception

            Finally
                Me.CommandCollection(0).CommandText = OriginalCommandText
                Me.CommandCollection(0).CommandTimeout = timeout
            End Try
        End Function



    End Class
End Namespace